//
//  YZSearchResultTableViewController.swift
//  SwiftTest
//
//  Created by Linyongzhi on 16/4/27.
//  Copyright © 2016年 Uama. All rights reserved.
//

import UIKit

class YZSearchResultTableViewController: UITableViewController {
    
    private var headerView: UITableViewHeaderFooterView!
        
    override func viewDidLoad() {
        super.viewDidLoad()

        self.tableView.registerNib(UINib(nibName: "YZTableViewCell", bundle: nil), forCellReuseIdentifier: YZTableViewCell.kReUsedIdentifier)
        
        self.edgesForExtendedLayout = UIRectEdge.None
        
        // Uncomment the following line to preserve selection between presentations
        // self.clearsSelectionOnViewWillAppear = false

        // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
        // self.navigationItem.rightBarButtonItem = self.editButtonItem()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    // MARK: - Table view data source

    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 1
    }

    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 20
    }

    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier(YZTableViewCell.kReUsedIdentifier, forIndexPath: indexPath)
        
        cell.textLabel?.text = "西湖区"

        return cell
    }
    
    override func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return 30
    }
    
    override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
        return "搜索结果"
    }
    
    override func tableView(tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
        if let headerView = view as? UITableViewHeaderFooterView {
//            headerView.contentView.backgroundColor = UIColor.darkGrayColor()
            headerView.textLabel?.font = UIFont.systemFontOfSize(14)
        }
    }
    
}
